#pragma once

#include <vector>
#include "types.h"

namespace icache {

class file_sequence {
public:
	void create_by_example(const string & filename);
	void create_by_filter(const string & filter);
	void clear();
	bool empty() const;
	int duration() const;
	string const & filter() const;
	string const & basepath() const; ///< slash ended
	string const & relative_framepath(int n) const;
	string full_framepath(int n) const;
	int first_frame_num() const;
private:
	void set_basepath(string const & subpath);
private:
	string _filter; ///< absolute path, NOT relative to _basepath
	string _basepath;
	std::vector<string> _framepaths;
	int _first_frame_num;
};

//inlines

inline int file_sequence::duration() const
	{ return _framepaths.size(); }

inline bool file_sequence::empty() const
	{ return duration() == 0; }

inline string const & file_sequence::filter() const
	{ return _filter; }

inline string const & file_sequence::basepath() const
	{ return _basepath; }

inline string const & file_sequence::relative_framepath(int n) const
	{ return _framepaths[n]; }

inline string file_sequence::full_framepath(int n) const
	{ return _basepath + _framepaths[n]; }

inline int file_sequence::first_frame_num() const
	{ return _first_frame_num; }

} //namespace icache
